//
//  YDSingleStockNewsModel.m
//  PeiZiWangBei
//
//  Created by LK-IOS on 2018/1/9.
//  Copyright © 2018年 LK-IOS. All rights reserved.
//

#import "YDSingleStockNewsModel.h"

@implementation YDSingleStockNewsModel

+ (NSDictionary *)mj_replacedKeyFromPropertyName
{
    return @{
             @"Id" : @"id",
             };
}


-(NSString *)timeString
{
    NSString *str1=[NSString stringWithFormat:@"%@",self.createDate];
/*
 NSInteger x = [[str1 substringToIndex:10] integerValue];
 NSDate  *date1 = [NSDate dateWithTimeIntervalSince1970:x];
 NSDateFormatter *dateformatter=[[NSDateFormatter alloc]init];
 [dateformatter setDateFormat:@"yyyy-MM-dd HH:mm"];
 return [dateformatter stringFromDate:date1];
 */
    NSDateFormatter *formate = [[NSDateFormatter alloc] init];
    [formate setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSDate *date = [formate dateFromString:str1];
    
    NSDateFormatter *formate1 = [[NSDateFormatter alloc] init];
    [formate1 setDateFormat:@"yyyy-MM-dd HH:mm"];
    return [formate1 stringFromDate:date];
}

-(CGFloat)cellH
{
    //左右间距
    CGFloat marginL = rate375(20);
    //上下间距
    CGFloat marginT;
    if (isPhoneX) {
        marginT = rateX812(10);
    }else{
        marginT = rate750(10);
    }
    
    //图片frame
    CGFloat titleX = marginL;
    CGFloat titleY = marginT;
    CGFloat titleW = (LKScreenW - marginL * 2);
    CGFloat titleH = [NSString getWrapSpaceLabelHeight:_title withFont:[UIFont systemFontOfSize:font14ScreenWRate * LKScreenW] withWidth:titleW andWrapSpace:0.5 withSpace:1.0];
    
    _titleFrame = CGRectMake(titleX, titleY, titleW, titleH);
    
    
    //标题的frame
    CGFloat timeX = marginL;
    CGFloat timeY = CGRectGetMaxY(_titleFrame) + marginT;
    
    CGFloat timeH = [NSString getWrapSpaceLabelHeight:self.timeString withFont:[UIFont systemFontOfSize:font12ScreenWRate * LKScreenW] withWidth:200 andWrapSpace:0.5 withSpace:1.0];
    
    _timeFrame = CGRectMake(timeX, timeY, 200, timeH);
    return CGRectGetMaxY(_timeFrame) + marginT;
}

-(CGFloat)detailH
{
    //左右间距
    CGFloat marginL = rate375(20);
    //上下间距
    CGFloat marginT;
    if (isPhoneX) {
        marginT = rateX812(7);
    }else{
        marginT = rate750(7);
    }
    
    //图片frame
    CGFloat titleX = marginL;
    CGFloat titleY = marginT;
    CGFloat titleW = (LKScreenW - marginL * 2);
    CGFloat titleH = [NSString getWrapSpaceLabelHeight:_title withFont:[UIFont systemFontOfSize:font18ScreenWRate * LKScreenW] withWidth:titleW andWrapSpace:0.5 withSpace:1.0];
    
    _detailTitleFrame = CGRectMake(titleX, titleY, titleW, titleH);
    
    
    //标题的frame
    CGFloat timeX = marginL;
    CGFloat timeY = CGRectGetMaxY(_detailTitleFrame) + marginT;
    
    CGFloat timeH = [NSString getWrapSpaceLabelHeight:self.timeString withFont:[UIFont systemFontOfSize:font12ScreenWRate * LKScreenW] withWidth:200 andWrapSpace:0.5 withSpace:1.0];
    
    _detailTimeFrame = CGRectMake(timeX, timeY, 300, timeH);
    return CGRectGetMaxY(_detailTimeFrame) + marginT;
}

@end
